package com.water.devtool.define;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.water.devtool.constant.BeanType;

/**
 * 模块分类
 * 
 * @author sun.lihua
 *
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ModularBean extends DefineBean {
	private String code;
	private String desc;
	private String defaultDbType;
	private String defaultDataSource;
	private List<EntityBean> entities;
	@JsonIgnore
	private ProjectBean project;
	private String defaultSeqName;

	public void init() {
		if (entities != null) {
			for (EntityBean entityBean : entities) {
				entityBean.setModular(this);
				entityBean.init();
			}
		}
	}

	@Override
	@JsonIgnore
	public BeanType getType() {
		return BeanType.MODULAR;
	}

	public void addEntity(EntityBean entity) {
		if (entities == null) {
			entities = new ArrayList<EntityBean>();
		}
		entities.add(entity);

	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getDefaultDbType() {
		return defaultDbType;
	}

	public void setDefaultDbType(String defaultDbType) {
		this.defaultDbType = defaultDbType;
	}

	public String getDefaultDataSource() {
		return defaultDataSource;
	}

	public void setDefaultDataSource(String defaultDataSource) {
		this.defaultDataSource = defaultDataSource;
	}

	public List<EntityBean> getEntities() {
		return entities;
	}

	public void setEntities(List<EntityBean> entities) {
		this.entities = entities;
	}

	public ProjectBean getProject() {
		return project;
	}

	public void setProject(ProjectBean project) {
		this.project = project;
	}

	public String getDefaultSeqName() {
		return defaultSeqName;
	}

	public void setDefaultSeqName(String defaultSeqName) {
		this.defaultSeqName = defaultSeqName;
	}

}
